home *** CD-ROM | disk | FTP | other *** search
-
- package sub_arctic.lib;
-
- /**
- * Interactor predicate class that does an AND operation across the results of
- * two other interactor_pred objects it is composed out of. The composed
- * objects both get the same test object and parameters and so must be
- * compatible in terms of the object types they expect.
- *
- * @see sub_arctic.lib.base_interactor#traverse_and_collect
- * @author Scott Hudson
- */
- public class pred_and implements interactor_pred {
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /** First component predicate. */
- protected interactor_pred _op1 = null;
-
- /**
- * First component predicate.
- * @return interactor_pred the first component predicate.
- */
- public interactor_pred op1() {return _op1;}
-
- /**
- * Set first component predicate.
- * @param interactor_pred p the new first component predicate.
- */
- public void set_op1(interactor_pred p) {_op1 = p;}
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /** Second component predicate */
- protected interactor_pred _op2 = null;
-
- /**
- * Second component predicate.
- * @return interactor_pred the second component predicate.
- */
- public interactor_pred op2() {return _op2;}
-
- /**
- * Set second component predicate.
- * @param interactor_pred p the new first component predicate.
- */
- public void set_op2(interactor_pred p) {_op2 = p;}
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Construct new predicate from two other predicates.
- * @param interactor_pred p1 the first predicate.
- * @param interactor_pred p2 the second predicate.
- */
- public pred_and(interactor_pred p1, interactor_pred p2)
- {
- set_op1(p1);
- set_op2(p2);
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /** Perform the predicate test by ANDing the result of two component
- * predicates. Note: AND is done with && so the second predicate will not
- * be invoked if the first one returns false.
- *
- * @param obj the interactor the predicate is testing.
- * @param parameters the additional parameters (of subclass specific type)
- * to the predicate (passed to both component predicates).
- * @return AND of results from two component predicates.
- */
- public boolean test(interactor obj, Object parameters)
- {
- return op1().test(obj, parameters) && op2().test(obj, parameters);
- }
-
- //had:
- //* @exception sub_arctic.exception.bad_value thrown if the parameters
- //* parameter is not the proper type for one or the other component
- //* predicates.
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
- }
- /*=========================== COPYRIGHT NOTICE ===========================
-
- This file is part of the subArctic user interface toolkit.
-
- Copyright (c) 1996 Scott Hudson and Ian Smith
- All rights reserved.
-
- The subArctic system is freely available for most uses under the terms
- and conditions described in
- http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html
- and appearing in full in the lib/interactor.java source file.
-
- The current release and additional information about this software can be
- found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
-
- ========================================================================*/
-